package day01am;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author JokerQ
 * @date 2020/8/22 - 9:28
 */
public class InetAddressDemo {
    public static void main(String[] args) throws UnknownHostException {
        /*InetAddress byName = InetAddress.getByName("www.tmooc.cn");
        System.out.println(byName);*/
        InetAddress[] allByName = InetAddress.getAllByName("www.tmooc.cn");
        for (InetAddress address: allByName
             ) {
            System.out.println(address);
        }
        InetAddress localHost = InetAddress.getLocalHost();
        System.out.println("本地ip："+localHost);
        InetAddress loopbackAddress = InetAddress.getLoopbackAddress();
        System.out.println(loopbackAddress);
        InetAddress byAddress = InetAddress.getByAddress(new byte[]{-10, -20, -1, 0});
        System.out.println(byAddress);

    }
}
